home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / DJDEV203.ZIP / include / inlines / pc.h < prev   
Encoding:
C/C++ Source or Header  |  1998-06-28  |  1.3 KB  |  72 lines

  1. /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
  2. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  3. #ifndef __dj_include_Inline_pc_h_
  4. #define __dj_include_Inline_pc_h_
  5.  
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9.  
  10. extern __inline__ unsigned char
  11. inportb (unsigned short _port)
  12. {
  13.   unsigned char rv;
  14.   __asm__ __volatile__ ("inb %1, %0"
  15.       : "=a" (rv)
  16.       : "dN" (_port));
  17.   return rv;
  18. }
  19.  
  20. extern __inline__ unsigned short
  21. inportw (unsigned short _port)
  22. {
  23.   unsigned short rv;
  24.   __asm__ __volatile__ ("inw %1, %0"
  25.       : "=a" (rv)
  26.       : "dN" (_port));
  27.   return rv;
  28. }
  29.  
  30. extern __inline__ unsigned long
  31. inportl (unsigned short _port)
  32. {
  33.   unsigned long rv;
  34.   __asm__ __volatile__ ("inl %1, %0"
  35.       : "=a" (rv)
  36.       : "dN" (_port));
  37.   return rv;
  38. }
  39.  
  40. extern __inline__ void
  41. outportb (unsigned short _port, unsigned char _data)
  42. {
  43.   __asm__ __volatile__ ("outb %1, %0"
  44.       :
  45.       : "dN" (_port),
  46.         "a" (_data));
  47. }
  48.  
  49. extern __inline__ void
  50. outportw (unsigned short _port, unsigned short _data)
  51. {
  52.   __asm__ __volatile__ ("outw %1, %0"
  53.       :
  54.       : "dN" (_port),
  55.         "a" (_data));
  56. }
  57.  
  58. extern __inline__ void
  59. outportl (unsigned short _port, unsigned long _data)
  60. {
  61.   __asm__ __volatile__ ("outl %1, %0"
  62.       :
  63.       : "dN" (_port),
  64.         "a" (_data));
  65. }
  66.  
  67. #ifdef __cplusplus
  68. }
  69. #endif
  70.  
  71. #endif
  72.